package main;

import java.nio.charset.Charset;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		if (args.length < 1) {
			System.out.println("not enough parameters");
		}

		MessagingServer ms = new MessagingServer('$',
				Integer.parseInt(args[0]), Charset.forName("UTF-8"),
				new ThreadPool(5));
		Thread t = new Thread(ms);
		t.start();
		boolean isStop = false;
		while (!isStop) {
			Scanner in = new Scanner(System.in);
			System.out.print("kill me? (yes/no)");
			String command = in.nextLine();
			System.out.println("You entered : " + command);
			if (command.toLowerCase().equals("yes")) {
				ms.stop();
				isStop = true;
			}
		}
	}
}
